1. Field of the Invention
The present invention relates to the protection of the boot block or the BIOS recovery region, while allowing write accesses to that same region. In particular, the present invention relates to the preservation of certain code or data within a "protected" segment, while also allowing for updates of other code that is also stored in the same segment.
2. Description of the Related Art
When a computer, such as a personal computer (PC), is switched off, the computer typically loses the contents of its working main memory that it accesses. When the computer is restarted, or booted up, all drives and components accessed by the PC have to be reinitialized.
This reinitialization is performed by the Basic Input/Output System, or BIOS. The BIOS includes system programs for the basic input and output operations, and provides the software interface to the PC hardware. Typical BIOS functions provide access to the floppy disk, hard disk drives, interfaces, and graphics adapters. A nonvolatile storage (NVRAM), usually a EPROM/Flash RAM, stores the BIOS for use by the CPU.
Random access memory (RAM), including the NVRAM discussed above and the central processing unit (CPU), are included on the motherboard. The CPU is connected to a keyboard, by which a user enters data or commands. To display such inputs visually, the CPU is also connected to a graphics adapter, which accepts the data to display, and processes the data so that it can be displayed on a monitor or display.
The motherboard also includes memory that stores programs and data that the PC needs at power-up, because the PC loses the contents of its main memory when it is powered down. The CPU reads the programs in the memory, and executes them at power-up. In the memory there are various support routines for accessing the keyboard, the graphics adapter, etc., which are collectively known as the ROM-BIOS or BIOS, noted previously.
Graphics adapter cards typically have their own ROM-BIOS, by which the CPU on the motherboard calls the corresponding program in the ROM-BIOS of the graphics adapter card via a bus interface (e.g., RS-232C).
When it becomes necessary to add support for a new feature, functionality or just fix a bug, most systems allow one to "flash" the BIOS, so as to allow for an updated BIOS to be written into the PC's NVRAM. Once the BIOS is flashed, the PC uses the updated BIOS, which has now been written over the older BIOS.
Upon reset, the PC starts executing a block where the boot block code resides. In most systems, the region containing the boot block area is write protected and cannot be overwritten, and provides the code that the PC executes upon power up or reset. The boot block code typically ranges from about 8 Kbytes up to 32 Kbytes. It is a subset of the BIOS and is sufficient to read the floppy drive, and write to the flash part. The boot block code can be considered to be a self-contained "miniBIOS" with enough code so as to read the new BIOS image off a floppy or the like, and write that image to the flash part.
The boot block code in conventional PCs is protected from overwriting. Motherboard manufacturers, in general, do not provide a means for erasing the boot block region in order to protect the integrity of the recovery code. Conventional flash parts or memories are non-symmetrical, in a sense that they are designed with different-sized segments. Data is written into such memories on a segment-by-segment basis. For example, there may be two 8-Kbyte segments, one 16-Kbyte segment, one 32-Kbyte segment, and a plurality of 64-Kbyte segments. One of the 8-Kbyte segments may contain information on the manufacturer (e.g., name of manufacturer, model number of PC, etc.). The 16-Kbyte segment may contain the protected boot block code, and the other segments contain other data, such as updatable BIOS code or the like. Data in a segment can only be updated by erasing the entire contents of the segment to create a blank segment (e.g., all "0's"), and then by writing new data into the blank segment.
The means for accessing any particular segment of a memory is known to those of ordinary skill in the art. For example, one way of accessing a particular segment for rewriting is for the user to provide a special erase command byte to any address location in the particular segment that is to be updated. This special erase command byte is provided at the same time a Write Enable pin of the memory is enabled, such as by providing the proper voltage Vpp (5 volts or the like) to that pin. Once this has been performed, the particular segment is erased. A similar process is then performed to allow a writing to the particular segment (e.g., providing a special write command byte to the particular segment while enabling the Write Enable pin). Other ways of selecting a particular segment of memory for erasing and rewriting are known, and vary from manufacturer to manufacturer.
The 16-Kbyte segment containing the boot block code in the example described above is typically not available for updating (e.g., erasing and rewriting). The purpose of the boot block code in the 16-Kbyte segment that holds it is that, in a case where a BIOS image is updated (flashed) and power is lost during that process, the BIOS image that is read may be bad. In that case, if one tried to boot from the bad BIOS image, the user would not be able to do so due to the faulty BIOS image. However, by having recovery code present in the boot block that cannot be overwritten, the boot block code, which is executed every time the PC is powered up, includes code to determine whether the BIOS image is bad. If the BIOS image is correct, then the boot block code will skip recovery process code incorporated therein, and will allow control to be passed to the BIOS image so as to allow the BIOS image to be executed.
If the BIOS image is bad, which can be determined during execution of the boot block code by the performance of a simple check sum on the BIOS image, for exanple, then the boot block code will not allow the BIOS image to be executed. Instead, it will execute a recovery process. In the recovery process, the BIOS image will be rewritten, such as by the boot block code retrieving a BIOS image stored in a floppy disk inserted into a disk drive of the PC. The boot block code then checks the updated BIOS image and proceeds as explained above.
Nonsymmetrical flash parts or memories are typically more expensive to manufacture than symmetrical flash parts. That is, a flash part having only multiple 64-Kbyte segments is cheaper to manufacture than a flash part having multiple 64-Kbyte segments, one or more 16-Kbyte segments, and one or more 8-Kbyte segments. However, since the boot block code cannot be overwritten, having a 16-Kbyte segment that can be provided for just the boot block code (which typically is around 16 Kbytes in size) is useful, since that way no wasted memory space occurs.
In particular, since the boot block code cannot easily be erased and then rewritten, if the boot block code was provided in a larger segment, such as a 64-Kbyte segment, then that segment would also have to include other code that cannot be erased and then rewritten so as to make maximum utilization of the available memory space. Alternatively, the remaining space of the 64-Kbyte boot block segment could remain blank and thus unutilized. Thus, if the boot block code was 16 Kbytes in size, then the other 48 Kbytes of the 64 Kbyte boot block segment would either have to be unutilized (e.g., blank), or provided with code that cannot be updated.
In a sense, the boot block code may be considered to be the non-updatable portion of the BIOS code. The BIOS code that is updatable is typically placed contiguously with the non-updatable boot block code. While there may be portions of the BIOS code that are not updated very often, such as information on video drivers or logos to be displayed at power up, it may be desirable to update even that code from time to time. However, this is not a problem with asymmetrical flash parts, in which the boot block segment is sized to hold the boot block code, and not much else.